package com.one.blocks.mvc.enums;

import com.one.blocks.common.enums.CodeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author linfuxin Created on 2022-02-14 10:39:05
 */
@Getter
@AllArgsConstructor
public enum RepeatStrategyEnum implements CodeEnum {

    /**
     * 不检查
     */
    NONE(99),

    /**
     * 忽略
     */
    IGNORE(0),

    /**
     * 中断
     */
    BREAK_OFF(1),

    /**
     * 覆盖
     */
    OVERRIDE(2),

    ;

    private final int code;

    public static RepeatStrategyEnum getInstance(int code) {
        for (RepeatStrategyEnum value : values()) {
            if (value.code == code) {
                return value;
            }
        }
        return RepeatStrategyEnum.NONE;
    }
}
